<template>
  <div class="components-container">
        <!-- 详情 -->
    <sweet-modal ref="dialogInfo" class="dialog" :sweetModalMaxWidth="pageWidth">
      <h3>{{title}}</h3>
      <div :style="{maxHeight:maxHeight+'px'}" style="overflow:auto;">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 0px;">
          <legend>死者信息</legend>
          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label">逝者类型</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGBONETYPE2" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">到馆时间</label>
              <div class="layui-input-inline">
                <el-date-picker type="datetime" v-model="regDateTimeInfo" format="yyyy-MM-dd HH:mm" readonly></el-date-picker>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">证件类型</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGCARDTYPE" readonly></el-input>
              </div>
            </div>
            <!-- </div>
              <div class="layui-form-item"> -->
            <div class="layui-inline">
              <label class="layui-form-label">逝者姓名</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGNAME" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">逝者性别</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGSEXDESC" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">证件号码</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGCARDNO" readonly></el-input>
              </div>
            </div>
            <!-- </div>
              <div class="layui-form-item"> -->
            <div class="layui-inline">
              <label class="layui-form-label">详细地址</label>
              <div class="layui-input-inline">
                <el-input class="longertext" readonly v-model="regData.REGDETAILADDRESS">
                </el-input>
              </div>
            </div>
          </div>
          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label">出生日期</label>
              <div class="layui-input-inline">
                <el-date-picker type="date" readonly v-model="regDataEexend.RegBirthDate"></el-date-picker>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">死亡日期</label>
              <div class="layui-input-inline">
                <el-date-picker type="date" readonly v-model="regDataEexend.regDeathDate"></el-date-picker>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">逝者年龄</label>
              <div class="layui-input-inline">
                <el-input readonly v-model="regData.REGAGE"></el-input>
              </div>
            </div>
            <!-- </div>
              <div class="layui-form-item"> -->
            <div class="layui-inline">
              <label class="layui-form-label">死亡原因</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGCAUSADESC" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">火化日期</label>
              <div class="layui-input-inline">
                <el-date-picker type="date" readonly v-model="regDataEexend.regCremationDate"></el-date-picker>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">排队序号</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGDAYNUM" readonly></el-input>
              </div>
            </div>
            <!-- </div>
              <div class="layui-form-item"> -->
            <div class="layui-inline">
              <label class="layui-form-label">民族</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGNATION" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">户籍类别</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGHOUSEHOLDTYPE" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">户籍地址</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGHOUSEHOLDDESC" readonly></el-input>
              </div>
            </div>
            <!-- </div>
              <div class="layui-form-item"> -->
            <div class="layui-inline">
              <label class="layui-form-label">统计地址</label>
              <div class="layui-input-inline">
                <el-input v-model="addressInfo" readonly></el-input>
              </div>
            </div>
          </div>
        </fieldset>
        <fieldset class="layui-elem-field layui-field-title">
          <legend>家属信息</legend>
          <div class="layui-field-box">
            <div class="layui-form-item">
              <div class="layui-inline">
                <label class="layui-form-label">家属姓名</label>
                <div class="layui-input-inline">
                  <el-input v-model="regData.REGHANDLERNAME" readonly></el-input>
                </div>
              </div>
              <div class="layui-inline">
                <label class="layui-form-label">家属性别</label>
                <div class="layui-input-inline">
                  <el-input v-model="regData.REGHANDSEXDESC" readonly></el-input>
                </div>
              </div>
              <div class="layui-inline">
                <label class="layui-form-label">证件号码</label>
                <div class="layui-input-inline">
                  <el-input v-model="regData.REGHANDLERCARDNO" readonly></el-input>
                </div>
              </div>
            </div>
            <div class="layui-form-item">
              <div class="layui-inline">
                <label class="layui-form-label">详细地址</label>
                <div class="layui-input-inline">
                  <el-input class="longertext" :autosize="{ minRows: 2, maxRows: 4}" readonly v-model="regData.REGHANDLERHOUSEHOLD">
                  </el-input>
                </div>
              </div>
            </div>
            <div class="layui-form-item">

              <div class="layui-inline">
                <label class="layui-form-label">联系电话</label>
                <div class="layui-input-inline">
                  <el-input v-model="regData.REGHANDLERLINK" readonly></el-input>
                </div>
              </div>
              <div class="layui-inline">
                <label class="layui-form-label">逝者关系</label>
                <div class="layui-input-inline">
                  <el-input v-model="regData.REGRELATION" readonly></el-input>
                </div>
              </div>
            </div>
          </div>
        </fieldset>
        <fieldset class="layui-elem-field layui-field-title">
          <legend>火化信息</legend>
          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label">减免类型</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGISKEYPOINTDESC" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">骨灰去向</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGGHQXDESC" readonly></el-input>
              </div>
            </div>
            <!-- <div class="layui-inline">
              <label class="layui-form-label">服务方式</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGYITIQXDESC" readonly></el-input>
              </div>
            </div> -->
            <!-- </div>
              <div class="layui-form-item"> -->
            <div class="layui-inline">
              <label class="layui-form-label">接尸车辆</label>
              <div class="layui-input-inline">
                <el-input v-model="cdhdata.CARLIC" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">驾驶员</label>
              <div class="layui-input-inline">
                <el-input v-model="cdhdata.STANAME" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">里程数</label>
              <div class="layui-input-inline">
                <el-input v-model="cdhdata.CDHMILEAGE" :min="0" style="width:150px" readonly></el-input>公里
              </div>
            </div>
            <!-- </div>
              <div class="layui-form-item"> -->
            <div class="layui-inline">
              <label class="layui-form-label">接尸地点</label>
              <div class="layui-input-inline">
                <el-input class="longertext" v-model="carryAreaInfo" readonly></el-input>
              </div>
            </div>
          </div>

          <div class="layui-form-item">
             <div class="layui-inline">
              <label class="layui-form-label">冰柜号</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.ICENO" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">悼念厅</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.MEMNAME" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">灵堂号</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.LINNAME" readonly></el-input>
              </div>
            </div>
          </div>
          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label">备注</label>
              <div class="layui-input-inline">
                <el-input class="longertext" v-model="regData.REGREMARK" readonly></el-input>
              </div>
            </div>
          </div>
        </fieldset>
      </div>
      <div class="layui-form-item btnCenter sweet-btn">
        <el-button @click="closeDialog">取消</el-button>
      </div>
    </sweet-modal>
  </div>
  </template>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/common.scss";
.el-button + .el-button {
  margin-left: 0;
}

.longtext {
  width: 480px;
}

.longertext {
  width: 480px;
}

.sweet-btn {
  margin-top: 20px;
}

.layui-form-label[data-v-7e4f8d8c]{
  width: 82px;
}
</style>

<script>
import { ORDER } from "@/const/orderConst.js";
// import { Load, Unload, plugin } from "@/utils/scanCtrl.js";
import apiBase from "@/api/apiBase.js";
import {
  formatDate,
  timeStringToDate,
  dateStringToDate
} from "@/utils/date.js";
import sweetModal from "@/components/sweetModal";
import { codeValid } from "@/utils/IdentityCodeValid.js";
import scanWS from "@/utils/scanWebSocket.js";
import {
  MessageBox,
  Message
} from 'element-ui';
import { connects, InfoTextCallback} from "@/utils/OcxUtil.js";
import { textnum }  from "@/utils/OcxUtil.js";

window.onload = function() {
  // Load();
};
window.onunload = function() {
  Unload();
};
export default {
  name: "deadFileSearchreg",
  data() {
    return {
      //结账状态
      REGISCHECK:null,
      chdids:null,
      printUrl: null,
      printTitle: null,
      isShowCharge: true,
      pdfUrl: null,
      printUrl: null,
      //户籍所在地
      title: null,
      order: null,
      pageWidth: 1250,
      maxHeight: 550,
      ctyLists: [],
      ctyInfo: null,
      regDateTimeInfo: null,
      commonArea: null,
      //编码类型
      commonAddr: [],
      area: [],
      carryArea: [],
      household: [],
      causList: [],
      codeList: [],
      cause: [],
      cauinfo: [],
      szlx: [],
      szlx_backup: [],
      ytqx: [],
      ghqx: [],
      xblx: [],
      icenum: [],
      sfzjlx: [],
      gjlb: [],
      mz: [],
      whcdlx: [],
      hyzklx: [],
      zylx: [],
      zzmmlx: [],
      hjlblx: [],
      hjszdlx: [],
      jmlx: [],
      carLics: [],
      icelist: [],
      creTypes: [],
      serviceListType: [],
      drivers: [],
      addressInfo: null,
      regData: {
        REGID: null,
        REGPRPID: null,
        REGDATE: null,
        REGTIME: null,
        REGDAYNUM: null,
        REGBONETYPE: null,
        REGCAUSA: null,
        REGCAUSASON: null,
        REGDEATHID: null,
        REGREGPROVEUNIT: null,
        REGADDRESS: null,
        REGDEATHADDRESS: null,
        REGYITIQX: null,
        REGGHQX: null,
        REGNAME: null,
        REGSEX: null,
        REGAGE: null,
        REGCARDTYPE: null,
        REGCARDNO: "",
        REGBIRTHDATE: null,
        REGNATIONALITYTYPE: null,
        REGNATION: null,
        REGCULTURALDEGREE: null,
        REGMARRIAGE: null,
        REGJOB: null,
        REGPOLITICAL: null,
        REGHOUSEHOLDTYPE: null,
        REGHOUSETYPE: null,
        REGHOUSEHOLD: null,
        REGDETAILADDRESS: null,
        REGDEATHDATE: null,
        REGISKEYPOINT: null,
        REGHANDLERNAME: null,
        REGHANDSEX: null,
        REGHANDLERCARDTYPE: null,
        REGHANDLERCARDNO: "",
        REGHANDLERHOUSEHOLD: null,
        REGHANDLERLINK: null,
        REGRELATION: null,
        REGREMARK: null,
        REGBONETYPE2: null,
        //里程数
        REGLCS: null,
        //车辆信息
        REGCLXX: [],
        //驾驶员
        REGJSY: null,
        //冰柜号
        ICENO: null,
        ICEID: null,
        //悼念厅
        MEMNAME: null,
        //灵堂号
        LINNAME: null

      },
      cdhdata: {
        CARCODNAME: null,
        CDHCARID: null,
        CARLIC: null,
        CDHDRIVER: null,
        STANAME: null,
        CDHMILEAGE: null
      },
      cdhdataEexend: {
        cardata: []
      },
      regDataEexend: {
        regDeathDate: null,
        regDataTime: null,
        RegBirthDate: null,
        //火花日期
        regCremationDate: null
      },
      carryAreaInfo: null,
      isShowPdf: false,
      pdfPrintID: null,
      //火化日期
      regCremationDate: null,
      cardInfo: [],
      ischeck: null
    };
  },
  methods: {
    //获取编码
    getCode() {
      let data = {};
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Registration.QueryAllCode,
        res => {
          this.codeList = res.data.content;
          for (var i in this.codeList) {
            switch (this.codeList[i].CTPID) {
              case "逝者类型":
                this.szlx = this.codeList[i].Cods;
                this.regData.REGBONETYPE = this.szlx[0].CODNAME;
                break;
              case "遗体去向":
                this.ytqx = this.codeList[i].Cods;
                this.regData.REGYITIQX = this.ytqx[0].CODNAME;
                break;
              case "骨灰去向":
                this.ghqx = this.codeList[i].Cods;
                this.regData.REGGHQX = this.ghqx[0].CODNAME;
                break;
              case "性别类型":
                this.xblx = this.codeList[i].Cods;
                break;
              case "身份证件类型":
                this.sfzjlx = this.codeList[i].Cods;
                this.regData.REGCARDTYPE = this.sfzjlx[0].CODNAME;
                break;
              case "国籍类别":
                this.gjlb = this.codeList[i].Cods;
                break;
              case "民族":
                this.mz = this.codeList[i].Cods;
                this.regData.REGNATION = this.mz[0].CODNAME;
                break;
              case "文化程度类型":
                this.whcdlx = this.codeList[i].Cods;
                break;
              case "婚姻状况类型":
                this.hyzklx = this.codeList[i].Cods;
                break;
              case "职业类型":
                this.zylx = this.codeList[i].Cods;
                break;
              case "政治面貌类型":
                this.zzmmlx = this.codeList[i].Cods;
                break;
              case "户籍类别类型":
                this.hjlblx = this.codeList[i].Cods;
                break;
              case "户籍所在地类型":
                this.hjszdlx = this.codeList[i].Cods;
                break;
              case "减免类型":
                this.jmlx = this.codeList[i].Cods;
                this.regData.REGISKEYPOINT = this.jmlx[0].CODNAME;
                break;
              default:
            }
          }
        }
      );
    },
    //获取常用地址
    getCommonAddr() {
      let data = {};
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Code.GetCommonAddress,
        res => {
          this.commonAddr = res.data.content;
        }
      );
    },
  
    getAddr() {
      let data = {};
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Code.GetAddressMap,
        res => {
          let cardata = res.data.content;
          this.area = cardata.map(item => ({
            value: item.ADDID,
            label: item.ADDNAME,
            ADDLEVEL: item.ADDLEVEL,
            ADDTOPID: item.ADDTOPID,
            children: item.Children.map(itemStr => ({
              value: itemStr.ADDID,
              label: itemStr.ADDNAME,
              ADDLEVEL: itemStr.ADDLEVEL,
              ADDTOPID: itemStr.ADDTOPID
            }))
          }));
        }
      );
    },
    //获取死亡原因
    getCausa() {
      let data = {};
      apiBase.DoService(data, apiBase.getApiAdress().Code.GetCausa, res => {
        let caudata = res.data.content;
        this.cause = caudata.map(item => ({
          label: item.CAENAME,
          value: item.CAEID,
          children: item.Caus.map(itemCau => ({
            label: itemCau.CAUNAME,
            value: itemCau.CAUID
          }))
        }));
        if (this.cause[0] && this.cause[0].children[0])
          this.cauinfo = [this.cause[0].value, this.cause[0].children[0].value];
      });
    },
    //获取服务类型
    getServiceTypes() {
      let data = {};
      apiBase.DoService(data, apiBase.getApiAdress().Code.GetYitiqx, res => {
        this.serviceListType = res.data.content;
      });
    },
    //获取司机
    getDrivers() {
      let data = {};
      apiBase.DoService(data, apiBase.getApiAdress().Staff.QueryDriver, res => {
        let driverData = res.data.content,
          legendsDrivers = driverData.map(item => ({
            label: item.STANAME,
            value: item.STAID
          }));
        this.drivers = legendsDrivers;
      });
    },
    //获取户籍所在地
    getHousehold() {
      let data = {};
      apiBase.DoService(data, apiBase.getApiAdress().Code.GetHousehold, res => {
        let cardata = res.data.content;
        this.household = cardata.map(item => ({
          label: item.StaName,
          value: item.StaCode,
          children: item.List_Cty.map(itemCty => ({
            label: itemCty.CtyName,
            value: itemCty.CtyCode,
            children: itemCty.List_Cnt.map(itemCnt => ({
              label: itemCnt.CntName,
              value: itemCnt.CntCode
            }))
          }))
        }));
      });
    },
    //根据编码获取所在地
    getHouseholdInfo(code) {
      let data = {
        CODE: code
      };
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Registration.GetHousehold,
        res => {
          let ctydata = res.data.content;
          this.ctyLists = [ctydata.StaCode, ctydata.CtyCode, ctydata.CntCode];
          if (ctydata)
            this.ctyInfo =
              ctydata.StaName + "/" + ctydata.CtyName + "/" + ctydata.CntName;
        }
      );
    },
    //获取预约信息
    getReserveInfo(id) {
      let data = {
        PRPID: id
      };
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Reserve.DetailPhoneReserve,
        res => {
          let resdata = res.data.content;
          this.regData.REGPRPID = id;
          this.regData.REGDAYNUM = resdata.PRPDAYNUM;
          this.regData.REGHANDLERNAME = resdata.PRPLINKMAN;
          this.regData.REGNAME = resdata.PRPDEADNAME;
          this.regData.REGPRPID = resdata.PRPID;
          this.regData.REGADDRESS = resdata.PRPCORPSEADDRESS;
          this.regData.REGHANDLERLINK = resdata.PRPLINKPHONE;
          this.regData.REGYITIQX = resdata.PRPYITIQX;
          this.regData.REGREMARK = resdata.PRPDESCRIBE;
          this.regData.REGSEX = resdata.PRPDEADSEX;
          this.regData.REGAGE = resdata.PRPDEADAGE;
          // PRPCORPSEADDRESS
          this.regData.REGCYADDRESS = resdata.PRPADDID;
          if (resdata.Cdh) {
            this.cdhdataEexend.cardata = [
              resdata.Cdh.CARCODNAME,
              resdata.Cdh.CDHCARID
            ];
            this.cdhdata.CDHDRIVER = resdata.Cdh.CDHDRIVER;
          }
        }
      );
    },
    //获取车辆信息
    getCar() {
      let data = {};
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Car.QueryCarByType,
        res => {
          let cardata = res.data.content;
          let legendsCarData = cardata.map(item => ({
            label: item.CodeName,
            value: item.CodeValue,
            children: item.list_Cars.map(caritem => ({
              label: caritem.CARLIC,
              value: caritem.CARID
            }))
          }));
          this.carLics = legendsCarData;
        }
      );
    },
    //获取冰柜信息
    getIce() {
      let data = {};
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Ice.QueryIceByIceArea,
        res => {
          let icedata = res.data.content;
          let IceData = icedata.map(item => ({
            label: item.ICANAME,
            value: item.ICAID,
            children: item.list_Ices.map(iceitem => ({
              label: iceitem.ICENO,
              value: iceitem.ICEID
            }))
          }));
          this.icelist = IceData;
        }
      );
    },
    //获取未使用冰柜信息
    getnoIce(id){
      let data = {
        ICEID: id
      };
      apiBase.DoService(
        data,
        apiBase.getApiAdress().IceUse.QueryIceBynotuse,
        res => {
          this.icenum = res.data.content;
        }
      )
    },
    //获取火化炉类型
    getCreTypes() {
      apiBase.DoService(
        {},
        apiBase.getApiAdress().Code.GetCremationType,
        res => {
          let creTypeData = res.data.content,
            legendsCreData = creTypeData.map(item => ({
              label: item.CodeName,
              value: item.CodeValue
            }));
          this.creTypes = legendsCreData;
        }
      );
    },
    //初始化下拉框数据
    initSelectData() {
      //初始化下拉框数据
      this.getCode();
      this.getCausa();
      this.getHousehold();
      this.getCar();
      this.getCreTypes();
      this.getIce();
      this.getServiceTypes();
      this.getDrivers();
      this.getAddr();
    },
    //打开页面
    open(order,id,REGISCHECK) {
      if(REGISCHECK === "B"){
        this.ischeck = true;
      }else{
        this.ischeck = false;
      }
      this.order = order;
      this.maxHeight = window.innerHeight - 240;
      this.getCommonAddr();
      //清理数据
      this.dataRepeat();
      switch (this.order) {
        case ORDER.INFO://详情
          this.$refs.dialogInfo.open();
          this.getAddr();
          this.title = "登记详情";
          this.dataInfo(id);
          break;
        default:
      }
    },
   
    //取消按钮
    closeDialog() {
      this.$refs.dialogInfo.close();
    },

   //登记详情
    dataInfo(id) {
      let data = {
        REGID: id
      };
      apiBase.DoService (
        data,
        apiBase.getApiAdress().Registration.DetailCremationRegistration,
        res => {
          this.regData.REGBONETYPE = res.data.content.REGBONETYPE;//逝者类型 
          this.regData.REGBONETYPE2 = res.data.content.REGBONETYPEDESC;
          this.regData.REGSEX = res.data.content.REGSEX;//逝者性别
          this.regData.REGSEXDESC = res.data.content.REGSEXDESC;
          this.regData.REGCARDTYPE = res.data.content.REGCARDTYPE;//证件类型
          this.regData.REGNAME = res.data.content.REGNAME;//逝者姓名
          this.regData.REGCARDNO = res.data.content.REGCARDNO;//证件号码
          this.regData.REGDETAILADDRESS = res.data.content.REGDETAILADDRESS;//详细地址
          this.regData.REGAGE = res.data.content.REGAGE;//逝者年龄
          this.regData.REGDAYNUM = res.data.content.REGDAYNUM;//排队序号
          this.regData.REGNATION = res.data.content.REGNATION;//民族
          this.regData.REGHOUSEHOLDTYPE = res.data.content.REGHOUSEHOLDTYPE;//户籍类别
          this.regData.REGHANDSEX = res.data.content.REGHANDSEX;//家属性别
          this.regData.REGHANDSEXDESC = res.data.content.REGHANDSEXDESC;//详情中的家属性别
          this.regData.REGHANDLERCARDTYPE = res.data.content.REGHANDLERCARDTYPE;//证件类型
          this.regData.REGHANDLERNAME = res.data.content.REGHANDLERNAME;//家属姓名
          this.regData.REGHANDLERCARDNO = res.data.content.REGHANDLERCARDNO;//证件号码
          this.regData.REGHANDLERHOUSEHOLD = res.data.content.REGHANDLERHOUSEHOLD;//详细地址
          this.regData.REGHANDLERLINK = res.data.content.REGHANDLERLINK;//联系电话
          this.regData.REGRELATION = res.data.content.REGRELATION;//逝者关系
          this.regData.REGISKEYPOINT = res.data.content.REGISKEYPOINT;//减免类型
          this.regData.REGISKEYPOINTDESC = res.data.content.REGISKEYPOINTDESC;//详情中的减免类型
          this.regData.REGGHQX = res.data.content.REGGHQX;//骨灰去向
          this.regData.REGGHQXDESC = res.data.content.REGGHQXDESC;//详情骨灰去向
          this.regData.REGCYADDRESS = res.data.content.REGCYADDRESS;//接尸地址  常用地址
          this.regData.REGADDRESS = res.data.content.REGADDRESS; //接运地点
          this.regData.REGREMARK = res.data.content.REGREMARK;//备注
          this.regData.ICENO = res.data.content.ICENO;//冰柜号
          this.regData.MEMNAME = res.data.content.MEMNAME;//悼念厅
          this.regData.LINNAME = res.data.content.LINNAME;//灵堂号


          this.regData.REGID = res.data.content.REGID;
          this.regData.REGHOUSEHOLDDESC = res.data.content.REGHOUSEHOLDDESC;//详情中的户籍地址

          this.regData.REGCAUSADESC = res.data.content.REGCAUSADESC;//详情中的死亡原因

          this.regData.REGCAUSA = res.data.content.REGCAUSA;
          this.regData.REGCAUSASON = res.data.content.REGCAUSASON;
          this.regData.REGHOUSEHOLD = res.data.content.REGHOUSEHOLD;//逝者户籍所在地
          this.regData.REGADDID = res.data.content.REGADDID;

          this.carryAreaInfo = this.regData.REGADDRESS;
          this.regDateTimeInfo = timeStringToDate(//详情中的到馆时间
            res.data.content.REGTIME,
            res.data.content.REGDATE
          );
          this.regDataEexend.regDataTime = timeStringToDate(//修改中的到馆时间
            res.data.content.REGTIME,
            res.data.content.REGDATE
          );
         
          this.regDataEexend.RegBirthDate = dateStringToDate(//出生日期
            res.data.content.REGBIRTHDATE 
          );
        
          this.regDataEexend.regDeathDate = dateStringToDate(//死亡时间
            res.data.content.REGDEATHDATE
          );
          // this.$watch('regDataEexend.regDeathDate', function(val){this.regData.REGDEATHDATE = formatDate(val, "yyyyMMdd");}, {deep: true});
          this.regDataEexend.regCremationDate = dateStringToDate(//火化日期
            res.data.content.REGCREMATIONDATE
          );
          if (this.regDataEexend.regCremationDate == null) {
            this.regDataEexend.regCremationDate = new Date();
          }
          // this.$watch('regDataEexend.regCremationDate', function(val){this.regData.REGCREMATIONDATE = formatDate(val, "yyyyMMdd");}, {deep: true});
          let cdhdata = res.data.content.Cdh;
          if (cdhdata) {
            this.cdhdataEexend.cardata = [cdhdata.CARCODNAME, cdhdata.CDHCARID];
            this.cdhdata.CARLIC = cdhdata.CARLIC;
            this.cdhdata.CDHDRIVER = cdhdata.CDHDRIVER;
            this.cdhdata.CDHMILEAGE = cdhdata.CDHMILEAGE;
            this.cdhdata.STANAME = cdhdata.STANAME;
            if (
              !this.drivers.some(item => {
                return item.value == cdhdata.CDHDRIVER;
              })
            ) {
              this.drivers.push({
                label: cdhdata.STANAME,
                value: cdhdata.CDHDRIVER
              });
            }
            let findarry = this.carLics.filter(item => {
              return item.value === cdhdata.CARCODNAME;
            });
            if (findarry.length > 0) {
              let seachCarType = findarry[0];
              if (
                !seachCarType.children.some(item => {
                  return item.value === cdhdata.CDHCARID;
                })
              )
                seachCarType.children.push({
                  label: cdhdata.CARLIC,
                  value: cdhdata.CDHCARID
                });
            }
          };
          //获取冰柜号，放在这里为了方便取到ICEID
          this.getnoIce(res.data.content.ICEID);
          //初始化死亡原因
          this.cauinfo = [this.regData.REGCAUSA, this.regData.REGCAUSASON];
          // this.ctyLists = res.data.content.REGHOUSEHOLDDESC;
          //初始化户籍地址
          this.getHouseholdInfo(this.regData.REGHOUSEHOLD);
          let currentArea = [];
          let addrId = this.regData.REGADDID;
          let addrName = null;
          this.area.forEach(function(value, index, arr) {
            value.children.forEach(function(v, i, a) {
              if (v.value == addrId) {
                currentArea.push(v.ADDTOPID, v.value);
                addrName = value.label + " / " + v.label;
              }
            });
          });
          this.carryArea = currentArea;
          this.addressInfo = addrName;
        }
      );
    },
    refreshData() {
      this.$emit("refreshData");
    },
    //数据重置
    dataRepeat() {
      this.cardInfo = [];
      Object.assign(this.$data.regData, this.$options.data().regData);
      Object.assign(
        this.$data.regDataEexend,
        this.$options.data().regDataEexend
      );
      Object.assign(this.$data.cdhdata, this.$options.data().cdhdata);
      Object.assign(
        this.$data.cdhdataEexend,
        this.$options.data().cdhdataEexend
      );
      this.regDataEexend.regDataTime = null;
      this.regData.ICENO = null;
      this.causList = [];
      this.ctyLists = [];
      this.cauinfo = [];
      this.carryArea = [];
      if (this.order === ORDER.SELFREGISTER) {
        this.cdhdataEexend.cardata = ["自送", null];
      }
      if (this.$store.state.orginCode) {
        this.getHouseholdInfo(this.$store.state.orginCode);
      }
    },
  },
  components: {
    sweetModal
  },
};
</script>
